package com.tunnel.home.dao;

import org.axe.annotation.persistence.Dao;
import org.axe.annotation.persistence.Sql;
import org.axe.interface_.persistence.BaseRepository;

import com.tunnel.home.entity.PayLog;

@Dao
public interface PayLogDao extends BaseRepository{
	
	@Sql("update PayLog set status=-1 where status=0 and expireTime<now()")
	public int refreshStatus();
	
	@Sql("select * from PayLog where outTradeNo=?1")
	public PayLog get(String outTradeNo);
	
	@Sql("update PayLog set notify=?2,status=1 where outTradeNo=?1 and status in(-1,0)")
	public int setNotify(String outTradeNo,String notify);
	
	@Sql("update PayLog set payCodeUrl=?2 where id=?1")
	public int setPayCodeUrl(long id,String payCodeUrl);
	
	@Sql("select * from PayLog where userId=?1 order by id desc limit 1")
	public PayLog getLastPayLog(long userId);
	
}
